// 计时器
package main

import (
	"fmt"
	"time"
)

func main() {
	// 创建一个计时器，会在至少持续时间d之后将当前时间发送到其channel上
	// After()函数相当于NewTimer(d).C
	timer1 := time.NewTicker(1 * time.Second)
	fmt.Println("timer1:", timer1)
	fmt.Println("Now:", time.Now())

	for i := 0; i < 3; i++ {
		data := <-timer1.C
		fmt.Println(timer1.C)
		fmt.Println(data)
		fmt.Println(data)

	}

}
